﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Lan.Application.Controllers.Query
{
    [Route("api/calibration")]
    [ApiController]
    public class CalibrationController : BaseController
    {
        private readonly ICalibrationService _CalibrationService;
        private readonly ICameraService _CameraService;
        private readonly IRadarService _RadarService;
        private readonly IDefenceareaService _DefenceareaService;

        public CalibrationController(ICalibrationService CalibrationService, IDefenceareaService defenceareaService, ICameraService cameraService, IRadarService radarService)
        {
            _CalibrationService = CalibrationService;
            _DefenceareaService = defenceareaService;
            _CameraService = cameraService;
            _RadarService = radarService;

        }

        [HttpPost]
        public IActionResult AddDefencearea([FromBody] CalibrationDto parm)
        {
            var modal = parm.Adapt<Calibration>().ToCreate(HttpContext);

            var response = _CalibrationService.AddCalibration(modal);

            return Message(response);
        }

        [HttpGet("{Type}/{ips}")]
        public IActionResult GetCamera(string Type, string ips)
        {
            _CalibrationService.cameraPTZ(Type, ips);
            return Message("OK");
        }

        [HttpGet("Set/{Status}")]
        public IActionResult SetCalibrationTrack(bool Status)
        {
            _CalibrationService.SetTrack(Status);
            return Message("OK");
        }
    }
}
